<?php

namespace app\test\controller;

use app\common\controller\Api;
use app\user\traits\controllers\TraitUser;

class Index extends Api
{
    use TraitUser;

    public function getN()
    {
        // foreach (model('\\app\\manager\\model\\CampManagers')->all() as $value) {
        //     $value->sign = $this->user->uuid();
        //     $value->save();
        // }
        // halt(model('\\app\\manager\\model\\CampManagers')->all());
        halt(\Carbon\Carbon::now());
        $n = '1014905762047055';
        halt(\think\Hook::exec('app\\common\\behavior\\Refund','afterCreateRefund', $n));
        halt($this->user->diffDays('2017-10-30', '2017-10-1', false));
        halt(model('Camps')->changeRentMoneyBase(1));
        halt($this->intcar(2, '2017-10-1', '2017-10-20'));
        halt($this->user->Notices->getNoticeList());
    }
    /**
     * 检索房车
     * @return [type] [description]
     */
    public function getS()
    {
        halt($this->user->Notices->getNoticeList());
        return $this->search($this->request->param('r'));
    }

    public function getCar()
    {
        return $this->getCaravan($this->request->param('id'));
    }

    public function getShare()
    {
        return $this->getUsercar();
        return $this->setShare(2, '2018-1-1', '2018-1-13');
    }

    /**
     * 支付订单
     * @return [type] [description]
     */
    public function getPayOrder()
    {
        $param = model('user/Orders')->payOrder(['number' => $this->request->param('no')]);
        if (is_bool($param) && $param) {
            $this->success(Lang::get('Order has been paid successfully'), 'User/list');
        }else {
            $this->redirect(url('/pay/dopay', $param, true, 'api'));
        }
    }

    public function getIndex()
    {
        return model('user/Orders')->calculatePrice(2, '2017-5-1', '2017-10-30');
        return $this->getUsercapital('2017-5-1', '2017-5-30');
    }
}
